import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

import Layout from '@/views/component/keep-alive.vue'
Vue.use(VueRouter)

const routes = [
    //    {
    // 	path: '/',
    // 	name: 'home',
    // 	component: Home
    // },
    /***组件 数据**/
    {
        path: '/',
        component: Layout,
        redirect: '/extend-mount',
        children: [{
            path: "/extend-mount",
            name: "extend-mount",
            title: "extend-mount",
            component: () => import("../views/component/extend-mount.vue"),
            meta: { title: 'extend-mount', icon: 'dashboard', affix: true, ispri: 'true' }
        }]
    },
    {
        "name": "componets",
        "path": "/componets",
        "hidden": false,
        "redirect": "noRedirect",
        "component": Layout,
        "alwaysShow": true,
        "meta": {
            "title": "componet 组件",
            "icon": "tool",
            "noCache": false
        },
        "children": [
            {
                path: "componets",
                name: "componets",
                "hidden": false,
                component: () => import("../views/component/componets.vue"),
                "meta": {
                    "title": "内置componets",
                    "icon": "build",
                    "noCache": false
                }
            },
            {
                path: "nei_components",
                name: "nei_components",
                "hidden": false,
                component: () => import("../views/component/index.vue"),
                "meta": {
                    title: "内置组件",
                    "icon": "code",
                    "noCache": false
                }
            },
            {
                path: "component-about",
                name: "component-about",
                "hidden": false,
                component: () => import("../views/component/about.vue"),
                "meta": {
                    "title": "内置组件关于我们",
                    "icon": "swagger",
                    "noCache": false
                }
            },
            {
                path: "component-list",
                name: "component-list",
                "hidden": false,
                component: () => import("../views/component/list.vue"),
                "meta": {
                    "title": "内置组件list",
                    "icon": "swagger",
                    "noCache": false
                }
            },
            {
                path: 'f1',
                name: 'f1',
                "hidden": false,
                url: "http://www.baidu.com",
                iframeComponent: "true",
                "meta": {
                    "title": "百度",
                    "icon": "swagger",
                    "noCache": false
                }
            },
            {
                path: 'f2',
                name: 'f2',
                "hidden": false,
                url: "https://www.layui.com/admin/std/dist/views/",
                iframeComponent: "true",
                "meta": {
                    "title": "layui 官网",
                    "icon": "swagger",
                    "noCache": false
                }
            }
        ]
    },
    // // ***mock 数据**/
    {
        "name": "mock",
        "path": "mock",
        "hidden": false,
        "component": Layout,
        "meta": {
            "title": "mock 数据",
            "icon": "guide",
            "noCache": false
        }
    },
    {
        path: "/mock",
        name: "mock",
        children: [{
            path: 'dashboard',
            name: 'Dashboard',
            component: () => import("../views/mockTest/index.vue"),
            meta: { title: "mock 数据", icon: 'mock', affix: true, ispri: 'true' }
        }]

    },
    // // ***插件 pulgin 封装*/
    {
        path: "/pulgin",
        name: "pulgin",
        children: [{
            path: 'pulgin',
            name: 'pulgin',
            component: () => import("../views/pulgin/index.vue"),
            meta: { title: "pulgin 封装", icon: 'mock', affix: true, ispri: 'true' }
        }]

    },
    // ***mixin 封装*/
    {
        path: "/mixin",
        name: "mixin",
        children: [{
            path: 'indexs',
            name: 'indexs',
            component: () => import("../views/mixin/index.vue"),
            meta: { title: "mixin 封装", icon: 'mock', affix: true, ispri: 'true' }
        }]

    },
    // ***数据访问相关*/
    {
        path: "/devServer",
        name: "devServer",
        title: "devServer数据访问",
        component: () => import("../views/devServer/index.vue")
    },
    // ***渲染函数 css模块引用*/
    {
        path: "/createElement",
        name: "createElement",
        title: "createElement 渲染",
        component: () => import("../views/createElement/index.vue")
    },
    // *** 组件*/
    {
        path: "/assembly",
        name: "assembly",
        title: "组件",
        component: () => import("../views/assembly/index.vue")
    },
    // *** filter 的案例 开始/
    {
        path: "/filter",
        name: "filter",
        title: "filter 过滤",
        component: () => import("../views/filter/index.vue")
    },
    // *** 本地数据获取*/
    {
        path: "/localData",
        name: "localData",
        title: "localData 本地数据",
        component: () => import("../views/localData/index.vue")
    },
    // *** vuex 的案例 开始/
    {
        path: "/count",
        name: "count",
        title: "vuex",
        component: () => import("../views/vuex-dome/count.vue")
    },
    {
        path: "/login",
        name: "login",
        title: "登录",
        component: () => import("../views/vuex-dome/login.vue")
    },
    // {
    //      path: "/",
    //      name: "index",
    //      component: () => import("../views/vuex-dome/index.vue")
    // },
    {
        path: "/userCenter",
        name: "userCenter",
        title: "用户中心",
        component: () => import("../views/vuex-dome/userCenter.vue")
    },
    {
        path: "/course/:id",
        name: "course",
        title: "vuex 案例",
        component: () => import("../views/vuex-dome/course.vue")
    }
    // *** vuex 的案例 结束/

]

const router = new VueRouter({
    routes
})

export default router